import 'package:flutter_taotaoshipin/generated/json/base/json_convert_content.dart';
import 'package:flutter_taotaoshipin/model/phone_login_entity.dart';

PhoneLoginEntity $PhoneLoginEntityFromJson(Map<String, dynamic> json) {
  final PhoneLoginEntity phoneLoginEntity = PhoneLoginEntity();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    phoneLoginEntity.id = id;
  }
  final String? sessionId = jsonConvert.convert<String>(json['session_id']);
  if (sessionId != null) {
    phoneLoginEntity.sessionId = sessionId;
  }
  final int? accountType = jsonConvert.convert<int>(json['account_type']);
  if (accountType != null) {
    phoneLoginEntity.accountType = accountType;
  }
  final PhoneLoginPlay? play = jsonConvert.convert<PhoneLoginPlay>(
      json['play']);
  if (play != null) {
    phoneLoginEntity.play = play;
  }
  return phoneLoginEntity;
}

Map<String, dynamic> $PhoneLoginEntityToJson(PhoneLoginEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['session_id'] = entity.sessionId;
  data['account_type'] = entity.accountType;
  data['play'] = entity.play?.toJson();
  return data;
}

extension PhoneLoginEntityExtension on PhoneLoginEntity {
  PhoneLoginEntity copyWith({
    int? id,
    String? sessionId,
    int? accountType,
    PhoneLoginPlay? play,
  }) {
    return PhoneLoginEntity()
      ..id = id ?? this.id
      ..sessionId = sessionId ?? this.sessionId
      ..accountType = accountType ?? this.accountType
      ..play = play ?? this.play;
  }
}

PhoneLoginPlay $PhoneLoginPlayFromJson(Map<String, dynamic> json) {
  final PhoneLoginPlay phoneLoginPlay = PhoneLoginPlay();
  final bool? auto = jsonConvert.convert<bool>(json['auto']);
  if (auto != null) {
    phoneLoginPlay.auto = auto;
  }
  final int? dramaId = jsonConvert.convert<int>(json['drama_id']);
  if (dramaId != null) {
    phoneLoginPlay.dramaId = dramaId;
  }
  final int? sort = jsonConvert.convert<int>(json['sort']);
  if (sort != null) {
    phoneLoginPlay.sort = sort;
  }
  return phoneLoginPlay;
}

Map<String, dynamic> $PhoneLoginPlayToJson(PhoneLoginPlay entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['auto'] = entity.auto;
  data['drama_id'] = entity.dramaId;
  data['sort'] = entity.sort;
  return data;
}

extension PhoneLoginPlayExtension on PhoneLoginPlay {
  PhoneLoginPlay copyWith({
    bool? auto,
    int? dramaId,
    int? sort,
  }) {
    return PhoneLoginPlay()
      ..auto = auto ?? this.auto
      ..dramaId = dramaId ?? this.dramaId
      ..sort = sort ?? this.sort;
  }
}